import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_query/getCardList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getListold = (pageNo, pageSize, params) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_query/cardList',
    method: 'get',
    params: {
      ...params,
      pageNo,
      pageSize,
    }
  })
}

/**
 * 卡片停机
 * @param iccid
 * @returns {AxiosPromise}
 */
export const pause = (iccid) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_change/pause',
    method: 'get',
    params: {
      iccid
    }
  })
}

/**
 * 卡片复机
 * @param iccid
 * @returns {AxiosPromise}
 */
export const resume = (iccid) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_change/resume',
    method: 'get',
    params: {
      iccid
    }
  })
}

/**
 * gprs 关闭
 * @param iccid
 * @returns {AxiosPromise}
 */
export const gprsClose = (iccid) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_change/gprsClose',
    method: 'get',
    params: {
      iccid
    }
  })
}

/**
 * gprs 开启
 * @param iccid
 * @returns {AxiosPromise}
 */
export const gprsOpen = (iccid) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_change/gprsOpen',
    method: 'get',
    params: {
      iccid
    }
  })
}

/**
 * 强制结束处于测试期资产
 * @param iccid
 * @returns {AxiosPromise}
 */
export const overtest = (iccid) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_change/overtest',
    method: 'get',
    params: {
      iccid
    }
  })
}

/**
 * 激活处于待激活(沉默期)状态的卡片
 * @param iccid
 * @returns {AxiosPromise}
 */
export const silenceactive = (iccid) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_change/silenceactive',
    method: 'get',
    params: {
      iccid
    }
  })
}

/**
 * 重置处于断网状态的卡
 * @param iccid
 * @returns {AxiosPromise}
 */
export const reset = (iccid) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_change/reset',
    method: 'get',
    params: {
      iccid
    }
  })
}


/**
 * 根据卡片信息 获取可续费套餐
 * @param msisdn
 * @returns {AxiosPromise}
 */
export const setmealProduct = (iccid) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_increment/setmealProduct',
    method: 'get',
    params: {
      iccid
    }
  })
}

/**
 * 根据卡片信息 获取可续费套餐
 * @param msisdn
 * @returns {AxiosPromise}
 */
export const flowpackage = () => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_increment/flowpackage',
    method: 'get',
    params: {}
  })
}

/**
 * 进行充值操作
 * @param msisdn
 * @returns {AxiosPromise}
 */
export const recharge = (params) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_increment/recharge',
    method: 'post',
    params: {
      ...params
    }
  })
}

export const getDetail = (iccid) => {
  return request({
    url: '/api/rb-oem/oem/iot/iot_query/cardInfo',
    method: 'get',
    params: {
      iccid
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/rb-oem/oem/version/version/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/rb-oem/oem/version/version/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/rb-oem/oem/version/version/submit',
    method: 'post',
    data: row
  })
}

/* 版本号管理 导出 */
export const getExport = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-oem/oem/version/version/export',
    method: 'get',
    params: {
      ...params,
    }
  })
}

